<template>
	<view class="home">
		<view class="top"><image src="../../static/icon/zhuce/back.jpg" mode="scaleToFill"></image></view>
		<view class="bottom">
			<view class="log"><image src="/static/log.jpg" mode=""></image></view>
			<view class="input-content">
				<view class="input">
					<image src="../../static/all/zhuce/p.png" mode=""></image>
					<input type="text" value="" placeholder="请输入手机号或者账号" placeholder-class="shrumoren" />
				</view>
				<view class="input">
					<image src="../../static/all/zhuce/s.png" mode=""></image>
					<input type="text" value="" placeholder="请输入密码" placeholder-class="shrumoren" />
					<view class="wnagji" @click="p5">忘记密码</view>
				</view>
			</view>
			<view class="tag c99">
				<text @click="p4">注册账号</text>
				<text @click="shaoma">扫码登陆</text>
			</view>
			<view class="c1">
				<picker mode="selector" :value="index" :range="arr" @change="changetype">
					<view class="mxxx">
						{{ arr[index] }}
						<uni-icons type="arrowdown" color="#fff"></uni-icons>
					</view>
				</picker>
			</view>
			<view class="btn back" @click="login">登陆</view>
		</view>
	</view>
</template>

<script>
import { login } from '@/api/index.js';
import { MyShow } from '@/util/my.js';
export default {
	data() {
		return {
			arr: ['经纪人登陆', '后台登陆'],
			index: 0
		};
	},
	methods: {
		changetype(e) {
			if (e.target.value == 1) {
				uni.navigateTo({
					url: './adminlogin'
				});
				return;
			}
			this.index = e.target.value;
		},
		p5() {
			uni.navigateTo({
				url: './p5'
			});
		},
		p4() {
			uni.navigateTo({
				url: './p4'
			});
		},
		shaoma() {
			uni.navigateTo({
				url: './shaoma'
			});
		},
		async login() {
			try {
				let reslut = await login(this.info);
				//成功
				new MyShow('需要渲染的字段').tixing();
			} catch (e) {
				//TODO handle the exception
				new MyShow('需要渲染的字段').tixing();
			}
			// 成功跳转到登陆页面
			uni.switchTab({
				url:"../my/my"
			})
		}
	}
};
</script>

<style lang="scss">
@import './main.scss';
</style>
